package org.afk.sisy.io;

import java.nio.file.attribute.*;
import java.util.concurrent.*;

public class SisyTools
{
	public static boolean equalLastModifies(final FileTime a, final FileTime b)
	{
		final TimeUnit unit = SisyConstants.lastModifiedTimeUnit;
		return (Math.abs(a.to(unit) - b.to(unit)) <= SisyConstants.lastModifiedTollerance);
	}

	public static int compareLastModified(final FileTime lastModified, final FileTime lastModified2)
	{
		final long diff = lastModified.to(SisyConstants.lastModifiedTimeUnit) - lastModified2.to(TimeUnit.SECONDS);
		if (diff < 0)
			return -1;
		if (diff > 0)
			return 1;
		return 0;
	}
}
